package com.example.springboot_project.service.impl;

import com.example.springboot_project.entity.Students;
import com.example.springboot_project.mapper.StudentsMapper;
import com.example.springboot_project.service.StudentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentsServiceImpl implements StudentsService {
    //注入持久层
    @Autowired
    private StudentsMapper studentsMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return studentsMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Students record) {
        return studentsMapper.insert(record);
    }

    @Override
    public int insertSelective(Students record) {
        return studentsMapper.insertSelective(record);
    }

    @Override
    public int updateByPrimaryKey(Students record) {
        return studentsMapper.updateByPrimaryKey(record);
    }

    //查询全部
    @Override
    public List<Students> findAll() {
        List<Students> list = studentsMapper.findAll();
        return list;
    }

    @Override
    public Students selectByStuPhoneAndStuPwdAndStuName(String stuPhone, String stuPwd, String stuName) {
        Students login = studentsMapper.selectByStuPhoneAndStuPwdAndStuName(stuPhone,stuPwd,stuName);
        return login;
    }
}
